<template>
  <div class="box-show">
    <div class="z gonggao">
      <div class="title">
        Cloud设置
      </div>
      <div class="gg-left">
        <el-row>
          <el-col :span="8">
            <el-form
              size="mini"
              :model="ruleFrom"
              ref="ruleFrom"
              label-width="100px"
              class="demo-ruleForm"
            >
              <el-form-item
                label="appkey"
                prop="appkey"
                :rules="[{ required: true, message: 'app_key不能为空' }]"
              >
                <el-input
                  type="text"
                  v-model="ruleFrom.appkey"
                  autocomplete="off"
                  :disabled="true"
                ></el-input>
              </el-form-item>
              <el-form-item
                label="appsecret"
                prop="appsecret"
                :rules="[{ required: true, message: 'app_secret不能为空' }]"
              >
                <el-input
                  type="password"
                  v-model="ruleFrom.appsecret"
                  autocomplete="off"
                  :disabled="true"
                ></el-input>
              </el-form-item>
              <el-form-item style="text-align: left">
                <el-button
                  type="primary"
                  size="mini"
                  @click="submitForm('numberValidateForm')"
                  >提交</el-button
                >
              </el-form-item>
            </el-form>
          </el-col>
        </el-row>
      </div>
      <div
        style="font-size: 12px;color: #666666;text-align: left;padding-left: 30px"
      >
        说明：<br />
        1、Cloud配置用于APP与您的微擎进行通信的秘钥，不到万不得已，建议不要修改<br />
        2、如果提示通信失败，或者通信异常，可能是您购买的站点为同步到云端库，那么需要等待24小时，或者联系微信客服：pineach（ben）<br />
        3、如果购买后站点更换了域名，请及时联系微信客服：pineach（ben）重新授权
      </div>
    </div>
  </div>
</template>

<script>
import { cloudSetting_getInfoByUniacid } from "@/utils/do";
export default {
  name: "CloudSetting",
  props: {},
  data() {
    return {
      ruleFrom: {
        appkey: "",
        appsecret: ""
      }
    };
  },
  components: {
    // 第三方组件实例化
  },
  computed: {},
  methods: {
    // 方法
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    getInfoByUniacid() {
      let _this = this;
      _this.$store.commit("setIsLoading", true);
      cloudSetting_getInfoByUniacid(res => {
        _this.$store.commit("setIsLoading", false);
        if (res.code == 0) {
          _this.ruleFrom = res.date;
        } else {
          _this.$message.error(res.msg);
        }
      });
    }
  },
  mounted() {
    this.getInfoByUniacid();
  }
};
</script>

<style scoped>
@import "~@/assets/scss/index.css";
</style>
